import pandas as pd
import plotly.express as px
import numpy as np
#  x 和 y 的范围为一个周期
x = np.linspace(0, 2 * np.pi, 100)
y = np.linspace(0, 2 * np.pi, 100)
# 计算 z 坐标，满足 z = sin(x + y)
z = np.sin(x + y)
# 创建 DataFrame
df = pd.DataFrame({
    "x": x,
    "y": y,
    "z": z,
})
fig = px.scatter_3d(df, x="x", y="y", z="z", size=[4] * len(df), color="z",
                    color_continuous_scale='Viridis',
                    labels={'x': 'X', 'y': 'Y', 'z': 'Z'},
                    title='3D Scatter Plot of z = sin(x + y)')

fig.show()

